package com.project.collectAPI.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.project.collectAPI.dao.FirstclassDao;
import com.project.collectAPI.dao.SecondclassDao;
import com.project.collectAPI.entity.Firstclass;
import com.project.collectAPI.entity.Secondclass;
import com.project.collectAPI.service.FirstclassService;
import com.project.collectAPI.service.SecondclassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;

/**
 * (Secondclass)表服务实现类
 *
 * @author makejava
 * @since 2023-06-13 11:22:23
 */
@Service("secondclassService")
public class SecondclassServiceImpl extends ServiceImpl<SecondclassDao, Secondclass> implements SecondclassService {

    SecondclassService secondclassService; //声明使用接口

    @Autowired
    SecondclassDao secondclassDao;

    @Override
    public void SaveSecondClass(List<Secondclass> secondclasses) {
        boolean b = secondclassService.saveBatch(secondclasses);
    }

    @Override
    public List<Secondclass> getSecondClassByBrandName(String brandName) {
        List<Secondclass> getList=secondclassDao.selectList(new QueryWrapper<Secondclass>().eq("brandname",brandName));
        return !Objects.isNull(getList)?getList:null;
    }

    @Override
    public Secondclass getBySecondId(String SecondId) {
        Secondclass data=secondclassDao.selectOne(new QueryWrapper<Secondclass>().eq("secondid",SecondId));
        return !Objects.isNull(data)?data:null;
    }
}

